Demote errors in which-key--process-define-key-args
authorJustin Burkett <justin@burkett.cc>
Thu, 14 Dec 2017 01:52:09 +0000 (20:52 -0500)
committerJustin Burkett <justin@burkett.cc>
Thu, 14 Dec 2017 01:52:09 +0000 (20:52 -0500)
which-key.el

index 15b599a4f1c5b6888674848e484a50252257f296..fdef15b424cbb851a3bfe67b84c91d68a948e513 100644 (file)
@@ -913,15 +913,16 @@ If AT-ROOT is non-nil the binding is also placed at the root of MAP."
 to `which-key-replacement-alist' so that this binding is replaced
 in which-key with DESCRIPTION. This function is meant to be used
 as :before advice for `define-key'."
-  (when (and (consp def)
-             (stringp (car def))
-             (symbolp (cdr def)))
-    (let ((key-desc (regexp-quote (key-description key))))
-      (push (cons (cons (format "%s\\'" key-desc)
-                        (when (cdr def)
-                          (format "\\`%s\\'" (symbol-name (cdr def)))))
-                  (cons nil (car def)))
-            which-key-replacement-alist))))
+  (with-demoted-errors "Which-key extended define-key error: %s"
+    (when (and (consp def)
+               (stringp (car def))
+               (symbolp (cdr def)))
+      (let ((key-desc (regexp-quote (key-description key))))
+        (push (cons (cons (format "%s\\'" key-desc)
+                          (when (cdr def)
+                            (format "\\`%s\\'" (symbol-name (cdr def)))))
+                    (cons nil (car def)))
+              which-key-replacement-alist)))))
 
 (when which-key-enable-extended-define-key
   (advice-add #'define-key :before #'which-key--process-define-key-args))